/*=====================================================================
  This file is part of a Microsoft SQL Server Shared Source Application.
  Copyright (C) Microsoft Corporation.  All rights reserved.
 
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
======================================================= */

using System;
using System.Collections;
using System.Text;
using System.Xml.Serialization;

namespace Microsoft.SqlServer.BISystems.Tool
{
    /// <summary>
    /// This class defines tuple generation method, 
    /// either statically from a File or dynamically from querying cube.
    /// </summary>
    [Serializable]
    public class TokenKey
    {
        private string m_name;

        [XmlAttribute(DataType = "string", AttributeName = "Set")]
        /// <summary>
        /// The token set definition.  It an MDX expression.
        /// </summary>
        public string Name
        {
            get
            {
                return m_name;
            }
            set
            {
                try
                {
                    if (value == "")
                        throw new Exception("Tuple can not be empty.");

                    m_name = value;
                }
                catch (Exception e)
                {
                    throw new Exception("Error when deserializing tag \"Tuple\", attribute \"Set\", with value: " + value, e);
                }
            }
        }

        private string m_source;

        [XmlAttribute(DataType = "string", AttributeName = "File")]
        public string Source
        {
            get
            {
                return m_source;
            }
            set
            {
                try
                {
                    m_source = value;
                }
                catch (Exception e)
                {
                    throw new Exception("Error when deserializing tag \"Tuple\", attribute \"File\", with value: " + value, e);
                }
            }
        }
    }
}
